package logic.trails;

import com.jme.scene.Node;
import com.jme.scene.Spatial;

public class TrailVisibility {
	
	private Node parent;
	private Spatial child;
	
	private boolean isVisible;
	
	public TrailVisibility(Node parent, Spatial child) {
		this.parent = parent;
		this.child = child;
	}
	
	public void setVisible(boolean vis) {
		if(vis == isVisible) return;
		
		if(vis) parent.attachChild(child);
		else parent.detachChild(child);
		
		isVisible = vis;
	}
	
	public boolean isVisible() { return isVisible; }
}